const Tag = require('../../models/blog_tags');

const ControllerTags = {
    getList: async function (req, res, next) {
        try {
            let { category_id } = req.query;
            let list = null;

            if (category_id == 0) list = await Tag.all();

            if (category_id != 0) list = await Tag.select({ category_id });

            res.json({ code: 200, msg: '链接成功', data: { list } })
        } catch (e) {
            res.json({ code: 0, data: e })
        }
    }
}

module.exports = ControllerTags;